<?php
/**
 * Created by PhpStorm.
 * User: yangyou
 * Date: 2019/1/14 0014
 * Time: 10:31
 */

namespace app\index\controller;


use app\index\model\ColumnPage;
use app\index\model\Config;
use app\index\model\InformationClassification;

class about extends Base
{
    /**
     * Author:yang you
     * Time:2019-01-15 10:00:43
     * Describe:关于我们
     * @return \think\response\View
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function index()
    {
        $page_id = input("page_id/d",0);
        $ColumnPage = new ColumnPage();
        $columnPageList = $ColumnPage->childrenColumnList();
        if(empty($page_id)){
            $columnPageInfo = $ColumnPage->dataInfo('page_name','关于我们');
        }else{
            $columnPageInfo = $ColumnPage->info($page_id);
            if(empty($columnPageInfo)){
                abort(404,'页面不存在');
            }
        }
        return view('about/index',[
            'columnPageList' => $columnPageList,
            'columnPageInfo' => $columnPageInfo
        ]);

    }

    /**
     * Author:yang you
     * Time:2019-01-15 10:00:43
     * Describe:网站地图
     * @return \think\response\View
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function webMap()
    {
        $config = new Config();
        $informationClassification = new InformationClassification();
        $ColumnPage = new ColumnPage();
        //别墅层数
        $drawingfloor = config("numberBuildings");
        //别墅风格
        $drawingStyle = $config->getConfigTypeListPY("DrawingStyle");
        //结构形式
        $structureStyle = $config->configType("DrawingFrameStructure");
        //户型结构
        $houseStyle = $config->configType("DrawingProperty");
        //设计师分类
        $designerType = $config->designerType();//设计师种类
        //资讯类型
        $informationType = $informationClassification->informationClassificationList($parent_id="",$is_index="1");
        //关于我们
        $columnPageList = $ColumnPage->columnPageList($substation_id="1",0);
        foreach ($columnPageList as $key=>$val){
            $columnPageList[$key]['childrenList'] = $ColumnPage->columnPageList($substation_id="1",$val['page_id']);
        }
        return view('about/webMap',[
            'drawingfloor' => $drawingfloor,
            'houseStyle' => $houseStyle,
            'structureStyle' => $structureStyle,
            'drawingStyle' => $drawingStyle,
            'designerType' => $designerType,
            'informationType' => $informationType,
            'columnPageList' => $columnPageList
        ]);

    }

}